package golang

import (
	"fmt"
	"runtime"
	"testing"
	"unsafe"
)

/*
* todo
Go语言中对象的地址可能发生变化，因此指针不能从其他非指针类型的值生成：
*/
func TestMemory(t *testing.T) {
	var x int = 42
	var p uintptr = uintptr(unsafe.Pointer(&x))
	fmt.Println(p)
	runtime.GC()
	var px *int = (*int)(unsafe.Pointer(p))
	fmt.Println(px)
}
